<template>
  <div>
    <button @click="isShow = !isShow">显示/隐藏</button>
    <transition-group name="ttt" appear>
      <h1 v-show="!isShow" :key="1">你好啊！</h1>
      <h1 v-show="isShow" :key="2">小坏蛋！</h1>
    </transition-group>

  </div>
</template>

<script>
export default {
  name: 'Test1',
  data() {
    return {
      isShow: true
    }
  },
}
</script>

<style scoped>
h1 {
  background-color: orange;
}
/*开始的起点，离开的终点*/
.ttt-enter,.ttt-leave-to {
  transform: translateX(-100%);
}
/*开始的终点，离开的起点*/
.ttt-enter-to,.ttt-leave {
  transform: translateX(0px);
}
/*开始,离开的过度*/
.ttt-enter-active ,.ttt-leave-active {
  transition: 0.5s linear;
}
</style>
